package org.pdai.basic.parmpass;

public class PassByValueExample {
    public static void main(String[] args) {
        Dog dog = new Dog("A");
        System.out.println("main 1:" + dog.getObjectAddress());  // Dog@5cad8086
        func(dog);
        System.out.println("main 2:" + dog.getObjectAddress());  // Dog@5cad8086
        System.out.println("main name:" + dog.getName());
    }

    private static void func(Dog dog) {
        System.out.println("func 1:" + dog.getObjectAddress());  // Dog@5cad8086
        dog = new Dog("B");
        System.out.println("func 2:" + dog.getObjectAddress());  // Dog@6e0be858
        System.out.println("func name:" + dog.getName());
    }
}
